package com.example.question.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.question.entity.QuestionCategory;
import com.example.question.entity.Question;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 题目分类Mapper接口
 * 继承MyBatis-Plus的BaseMapper，提供基础的CRUD操作
 * 用于管理题目分类的数据库操作
 * @author 颜殿
 */
@Mapper
public interface QuestionCategoryMapper extends MPJBaseMapper<QuestionCategory> {
    
    @Select("SELECT COUNT(*) FROM question_category c LEFT JOIN interview_question q ON q.title = c.name WHERE c.name = #{categoryName}")
    Long countQuestionsByCategory(@Param("categoryName") String categoryName);
}